package com.ask.callabledemo;

import com.ask.threadcase1.MyRunnable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Main {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        // 多线程要执行的任务
        MyCallable mc = new MyCallable();
        // 创建FutureTask对象(管理多线程的运行结果)
        FutureTask<Integer> ft = new FutureTask<>(mc);
        Thread t1 = new Thread(ft);
        t1.start();
        Integer res= ft.get();
        System.out.println(res);
    }
}
